/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.posplus.losspreventiondataimporter.service;

import com.posplus.lossprevention.APDAOFactory;
import com.posplus.lossprevention.dao.NoSalesDAO;
import com.posplus.lossprevention.mapping.NoSales;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author scottw
 */
public class NoSalesService {
    
    private NoSalesDAO nsDAO;
    
    
    public NoSalesService(NoSalesDAO nsDAO){
        this.nsDAO = nsDAO;
    }
    
    public NoSalesService(APDAOFactory lpDAOFactory){
        this.nsDAO = lpDAOFactory.getNoSalesDAO();
    }
    
    public void bulkInsert(List<NoSales> noSales){
        nsDAO.bulkInsert(noSales);
    }

    public void saveAll(List<NoSales> noSales) {
        Iterator<NoSales> iter = noSales.iterator();
        while (iter.hasNext()) {
            nsDAO.save(iter.next());
        }
    }
}
